<?php

/**
 * @todo autoload
 * @version $Id: Autoload.php 685 2009-08-03 06:28:25Z songxiang $
 */

class Autoload {
    public function __construct(){
        
    }
    
    public static function registerAutoload () {
        spl_autoload_register(array(
            'Autoload' , 
            'autoload'));
    }
    
    public static function autoload ($class) {
        if (preg_match('/[A-Z].*(Controller|Model|Logic)$/', $class, $matches)) {
            require_once APP_PATH . strtolower($matches[1]) . DIRECTORY_SEPARATOR . $class . '.php';
        
        } else {
            $class = str_replace('_', DIRECTORY_SEPARATOR, $class);
            require_once FRAMEWORK_PATH . $class . '.php';
        }
    }
}

?>